<?php

chdir('../');

include('includes/setUp.php');
/*
$_POST['album'] = 53;
$_POST['uploaded'] = 3;*/

$album = new Album();
$album = $db->find('Album', $_POST['album']);

//$str = "Do alba $album->Name uzivatele {$album->User->UserName} bylo pridano {$_POST['uploaded']} fotografii";
//$str = sprintf(T_ngettext("(Into album %s of user %s was added %d new photo)", 
//                          "(Into album %s of user %s was added %d new photos)", 
//                          $_POST['uploaded']),
//               $album->Name, $album->User->UserName, $_POST['uploaded']);
//$str = sprintf(T_('Into album %s of user %s'),$album->Name, $album->User->UserName, $_POST['uploaded']);

$str = "User %s has added to the album %s %d new photo|{$album->Name}|{$album->User->UserName}|{$_POST['uploaded']}|";

$i=0;
foreach ($album->FavoritesByUsers as $favUser) {
  $notify[$i] = new Notification($favUser, $str);
  $db->persist($notify[$i++]);
}

$db->flush();


//$_POST['uploaded']
//$_POST['album']
/*
echo $str;

$fp = fopen('data.txt', 'w');
fwrite($fp, $str);
fclose($fp);*/
?>
